﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Configuration;
using System.IO;

/// <summary>
///WebHelper 的摘要说明
/// </summary>
public class WebHelper
{
    public WebHelper()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }

    public static bool IsAllowableFileType(string FileName)
    {
        //从web.config读取判断文件类型限制
        string strFileTypeLimit = ConfigurationManager.AppSettings["FileType"].ToString();
        //当前文件扩展名是否包含在这个字符串中
        if (strFileTypeLimit.IndexOf(Path.GetExtension(FileName).ToLower()) != -1)
        {
            return true;
        }
        else
            return false;
    }

    public static void Alert(string Msg, int type)
    {
        Msg = "ZENG.msgbox.show(\"" + Msg + "\"," + type + ",1000);";
        Page handler = (Page)HttpContext.Current.Handler;
        handler.ClientScript.RegisterStartupScript(typeof(string), "", Msg, true);
    }
}